Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tiptap/extension-bubble-menu

Package Overview
Dependencies
Maintainers
5
Versions
189
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tiptap/extension-bubble-menu

bubble-menu extension for tiptap

  • 2.10.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
838K
decreased by-26.62%
Maintainers
5
Weekly downloads
 
Created

What is @tiptap/extension-bubble-menu?

@tiptap/extension-bubble-menu is an extension for the Tiptap editor that provides a contextual menu (bubble menu) that appears when you select text. This menu can be customized to include various formatting options and actions, making it a powerful tool for enhancing the user experience in rich text editing.

What are @tiptap/extension-bubble-menu's main functionalities?

Basic Bubble Menu

This code sets up a basic bubble menu that appears when text is selected. The menu is linked to a DOM element with the class 'bubble-menu'.

import { BubbleMenu } from '@tiptap/extension-bubble-menu';
import { Editor } from '@tiptap/core';
import StarterKit from '@tiptap/starter-kit';

const editor = new Editor({
  extensions: [
    StarterKit,
    BubbleMenu.configure({
      element: document.querySelector('.bubble-menu'),
    }),
  ],
});

Custom Bubble Menu

This code configures a custom bubble menu with additional Tippy.js options, such as setting the duration of the menu's appearance animation.

import { BubbleMenu } from '@tiptap/extension-bubble-menu';
import { Editor } from '@tiptap/core';
import StarterKit from '@tiptap/starter-kit';

const editor = new Editor({
  extensions: [
    StarterKit,
    BubbleMenu.configure({
      element: document.querySelector('.custom-bubble-menu'),
      tippyOptions: {
        duration: 100,
      },
    }),
  ],
});

Conditional Bubble Menu

This code sets up a bubble menu that only appears when there is a text selection (i.e., the selection is not empty).

import { BubbleMenu } from '@tiptap/extension-bubble-menu';
import { Editor } from '@tiptap/core';
import StarterKit from '@tiptap/starter-kit';

const editor = new Editor({
  extensions: [
    StarterKit,
    BubbleMenu.configure({
      element: document.querySelector('.conditional-bubble-menu'),
      shouldShow: ({ state }) => {
        return state.selection.empty === false;
      },
    }),
  ],
});

Other packages similar to @tiptap/extension-bubble-menu

Keywords

FAQs

Package last updated on 26 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc